window.onload = function () {
    //var reg = /^(13[0-9]|14[5|7]|15[0|1|2|3|4|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])\d{8}$/;
    var reg = /^1[3|4|5|7|8]\d{9}$/;
    var cipher = /^[a-zA-Z]\w{5,17}$/;
    var tel = document.querySelector('#tel');
    var mma = document.querySelector('#mma');
    var qr = document.querySelector("#qr");
    var cw = '<img src="images/icon_x.png" alt="">手机号码格式不正确，请从新输入';
    var qrr = '<img src="images/icon_x.png" alt="">密码格式不正确，请从新输入';
    function change(obj, dx, pc) {
        obj.onblur = function () {
            if (dx.test(this.value)) {
                this.nextElementSibling.innerHTML = '输入正确';
                this.nextElementSibling.style.color = 'blue';
            }
            else {

                this.nextElementSibling.innerHTML = pc;
                this.nextElementSibling.style.color = 'red';
            }
        }
    }
    qr.onblur = function () {
        if (this.value == mma.value) {
            this.nextElementSibling.innerHTML = '输入正确';
            this.nextElementSibling.style.color = 'blue';
        }
        else {
            this.nextElementSibling.innerHTML = '输入错误';
            this.nextElementSibling.style.color = 'red';
        }

    }
    change(tel, reg, cw);//电话
    change(mma, cipher, qrr);//密码

}